package com.ibeetl.cms.service;

import java.util.List;

import com.ibeetl.cms.entity.IndustrialTalents;
import com.ibeetl.cms.entity.PreparatoryTalent;
import com.ibeetl.cms.web.query.SkillQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.ibeetl.cms.dao.SkillDao;
import com.ibeetl.cms.entity.Skill;
import com.ibeetl.admin.core.service.BaseService;

/**
 * Skill Service
 */

@Service
@Transactional
public class SkillService extends BaseService<Skill>{

    @Autowired
    private SkillDao skillDao;

    public PageQuery<Skill>queryByCondition(PageQuery query){
        PageQuery ret =  skillDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public List<Skill>queryCompany(SkillQuery condtion){
        List ret =  skillDao.queryCompany(condtion);
        queryListAfter(ret);
        return ret;
    }
    public PageQuery<Skill> queryEmployees(PageQuery page) {
        page.setPageSize(Integer.MAX_VALUE);

        PageQuery ret =  skillDao.queryEmployees(page);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelSkill(List<Long> ids){
        try {
            skillDao.batchDelSkillByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除Skill失败", e);
        }
    }
    //查企业
    public PageQuery<Skill>findenterprise(PageQuery query){
        PageQuery ret =  skillDao.findenterprise(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public PageQuery<Skill> queryDoneTask(PageQuery page) {
        PageQuery ret =  skillDao.queryDoneTask(page);
        queryListAfter(ret.getList());
        return ret;

    }

    public int queryEmployeesCount(SkillQuery condition) {
        return skillDao.queryEmployeesCount(condition);
    }
}